# -- coding: utf-8 --
# @Time : 2021/3/10--19:47
# @Author : ChinaV
# @File : 《从清华到MIT》词频统计.py

# 在_____处填写一行代码
# 在…处填写多行代码
# 不允许修改其他代码
import jieba

dk = {}
with open('data.txt', 'r', encoding='utf-8') as f:
    txt = f.read()
# print(txt)
l = jieba.lcut(txt, cut_all=True)  # 完全
l2 = jieba.lcut(txt)  # 非完全
# print(l)
# print(l2)
dk = {}
for i in l:
    if len(i) == 2:
        dk[i] = dk.get(i, 0) + 1
dp = list(dk.items())
dp.sort(key=lambda x: int(x[1]), reverse=True)
# print(dp)
for i in range(10):
    print("{}:{}".format(dp[i][0], dp[i][1]))
